<template>
  <el-row :gutter="30" class="panel-group">
    <el-col
      v-for="(item, index) in countArr"
      :key="index"
      :md="countArr.length % 3 === 0 ? 8 : 12"
      class="card-panel-col"
    >
      <router-link :to="item.to || ''">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper" :class="[`icon-${item.icon}`]">
            <svg-icon :icon-class="item.icon" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">{{ item.text }}</div>
            <div class="card-panel-num">{{ item.num || 0 }}</div>
          </div>
        </div>
      </router-link>
    </el-col>
  </el-row>
</template>

<script>
import permission from '@/directive/permission'; // 权限判断指令

export default {
  directives: {
    permission,
  },
  props: {
    countArr: {},
  },
  data() {
    return {
      type: ['money', 'people'],
    };
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 138px;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-around;

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-tree {
        background: #40c9c6;
      }

      .icon-chart {
        background: #36a3f7;
      }

      .icon-dashboard {
        background: #f4516c;
      }

      .icon-money {
        background: #ffa600;
      }
    }

    .icon-tree {
      color: #40c9c6;
    }

    .icon-chart {
      color: #36a3f7;
    }

    .icon-dashboard {
      color: #f4516c;
    }

    .icon-money {
      color: #ffa600;
    }

    .card-panel-icon-wrapper {
      float: left;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      display: flex;
      flex-direction: column;
      align-items: flex-end;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-row {
        display: flex;
        align-items: center;
        position: relative;
      }

      .card-panel-tips {
        position: absolute;
        white-space: nowrap;
        right: 80px;
        color: #999;
        font-size: 10px;
        font-weight: 300;
      }

      .card-panel-num {
        font-size: 20px;
      }

      .card-panel-btn {
        margin-right: 40px;
      }
    }
  }
}

// @media (max-width: 550px) {
//   .card-panel-description {
//     display: none;
//   }

//   .card-panel-icon-wrapper {
//     float: none !important;
//     width: 100%;
//     height: 100%;
//     margin: 0 !important;

//     .svg-icon {
//       display: block;
//       margin: 14px auto !important;
//       float: none !important;
//     }
//   }
// }
</style>
